export function apiManagementColumns() {
    const COLUMN_WIDTH = window.RPConfig.COLUMN_WIDTH
    return [
        {
            type: "selection",
            align: "left",
            width: 50
        },
        {
            title: this.$t("module.apiManage.interfaceAddress"), // 租户编码
            key: "apiPath",
            sortable: "apiPath"
        },
        {
            title: this.$t("module.apiManage.interfaceDescription"), // 租户名称
            key: "apiDesc",
            sortable: "apiDesc"
        },
        {
            title: this.$t("module.apiManage.requestMethod"),
            key: "requestMethod",
            sortable: "requestMethod",
            align: "center",
            minWidth: COLUMN_WIDTH.COLUMN_WIDTH_4_WORDS,
            maxWidth: COLUMN_WIDTH.COLUMN_WIDTH_4_WORDS + COLUMN_WIDTH.MAX_WIDTH_MORE,

        },
        {
            title: this.$t("module.apiManage.enableStatus"),
            key: "enabled",
            sortable: "enabled",
            align: "center",
            minWidth: 80,
            maxWidth: 80 + COLUMN_WIDTH.MAX_WIDTH_MORE,
            render: (h, params) => {
                return h(
                    "StatusButton",
                    {
                        // 修改StatusButton内容居中
                        style: {
                          "justify-content": "center"
                        },
                        props: {
                            status: params.row.enabled == 1 ? "0" : "1"
                        }
                    },
                    params.row.enabled == 1 ? this.$t("common.enable") : this.$t("common.disable")
                );
            }
        },
        {
            title: this.$t("common.operating"),
            align: "left",
            fixed: "right",
            width: 120,
            render: (h, params) => {
                return h("RowTools", {
                    props: {
                        data: [
                            {
                                type: "icon",
                                icon: "md-create",
                                text: this.$t("common.edit"),
                                handle: () => {
                                    this.onApiEdit(params.row);
                                }
                            },
                            {
                                type: "icon",
                                icon: "ios-eye",
                                text: this.$t("common.detail"),
                                handle: () => {
                                    this.onDetail(params.row);
                                }
                            },
                            {
                                type: "icon",
                                icon: "ios-trash",
                                text: this.$t("common.delete"),
                                hidden: params.row.enabled == 1 ? true : false,
                                handle: () => {
                                    this.onDelApi('single', params.row);
                                }
                            }
                        ]
                    }
                });
            }
        }
    ];
}
export function swaggerColumns() {
    return [
        {
            type: "selection",
            align: "left",
            width: 50
        },
        {
            title: this.$t("module.apiManage.interfaceAddress"), // 租户编码
            key: "apiPath",
            sortable: "apiPath"
        },
        {
            title: this.$t("module.apiManage.requestMethod"),
            key: "requestMethod",
            sortable: "requestMethod",
            width: 120
        },
        {
            title: this.$t("module.apiManage.interfaceDescription"), // 租户名称
            key: "apiDesc",
            sortable: "apiDesc"
        }
    ];
}